#include <AVUIGradientBrush.h>

namespace AVUI {

class IClientLinearGradientBrush;

class LinearGradientBrush : public GradientBrush
{
public:
    LinearGradientBrush();
    ~LinearGradientBrush();


    DECLARE_ELEMENT(LinearGradientBrush, GradientBrush);

    DECLARE_DEPENDENCY_PROPERTY(StartPoint);
    Point get_StartPoint() { return m_startPoint; }
    void set_StartPoint(const Point& value) { SetValue(get_StartPointProperty(), AVUI::BoxValue(value)); } 

    DECLARE_DEPENDENCY_PROPERTY(EndPoint);
    Point get_EndPoint() { return m_endPoint; }
    void set_EndPoint(const Point& value) { SetValue(get_EndPointProperty(), AVUI::BoxValue(value)); } 

    virtual void set_ActiveBrush(Renderer* pRenderer);

protected:

    virtual void OnGradientStopsChanged();
    virtual void CloneCore(Freezable* pSource);
    virtual TRefCountedPtr<Freezable> CreateInstanceCore() AVUI_OVERRIDE { return object_allocate<LinearGradientBrush>().get_Ptr(); }

private:
    static void StaticConstructor();

    static void OnStartPointChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);
    static void OnEndPointChanged(DependencyObject* pDO, DependencyPropertyChangedEventArgs* e);


    Point m_startPoint;
    Point m_endPoint;

    IClientLinearGradientBrush* m_pClientLinearGradientBrush;
    mutable bool m_needsGradientUpdate;
};

typedef TRefCountedPtr<LinearGradientBrush> LinearGradientBrushPtr;

}; // namespace AVUI
